
public class Util {

	public static int convByteOrderInt(int i) {
		int result = 0;
		result = (i & 0xff000000) >>> 24 | (i & 0x00ff0000) >> 8 | 
				(i & 0x0000ff00) << 8 | (i & 0x000000ff) << 24;
		return result;
	}

	public static short convByteOrderShort(int i) {
		int result = 0;
		result = (i & 0xff00) >>> 8 | (i & 0x00ff) << 8;
		return (short)result;
	}

	public static int getUnsignbyte(byte b) {
		return b<0?b+0x100:b;
	}
	
	public static void prtArray(byte[] b) {
	//		//debug to print fileHead
			int prntmp=0;
			for (int i=0; i<b.length; i++) {
				System.out.print(b[i] + ", ");
				prntmp++;
				if (prntmp == 16) {
					prntmp = 0;
					System.out.println();
				}
			}
		}

}
